package cn.edu.xjtu.work.invertTree;

import cn.edu.xjtu.Util.TreeNode.TreeNode;

/**
 * 226. 翻转二叉树
 * 
 * 翻转一棵二叉树。
 */
public class Solution {
  public TreeNode invertTree(TreeNode root) {
    if (root == null) {
      return null;
    }
    TreeNode temp = root.left;
    root.left = root.right;
    root.right = temp;
    invertTree(root.left);
    invertTree(root.right);
    return root;
  }
}
